﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace NimbleTextKeygen
{
    public class AssemblyAttributes
    {
        private static bool https;

        private static AssemblyVersion assemblyVersion;

        public static string ProductName;

        public static int ProductID;

        public const string k5 = "141264756876943918358326";

        public static string AssemblyCompany
        {
            get
            {
                object[] customAttributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false);
                if (customAttributes.Length == 0)
                {
                    return "";
                }
                return ((AssemblyCompanyAttribute)customAttributes[0]).Company;
            }
        }

        public static string AssemblyCopyright
        {
            get
            {
                object[] customAttributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyCopyrightAttribute), false);
                if (customAttributes.Length == 0)
                {
                    return "";
                }
                return ((AssemblyCopyrightAttribute)customAttributes[0]).Copyright;
            }
        }

        public static string AssemblyDescription
        {
            get
            {
                object[] customAttributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyDescriptionAttribute), false);
                if (customAttributes.Length == 0)
                {
                    return "";
                }
                return ((AssemblyDescriptionAttribute)customAttributes[0]).Description;
            }
        }

        public static string AssemblyProduct
        {
            get
            {
                object[] customAttributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyProductAttribute), false);
                if (customAttributes.Length == 0)
                {
                    return "";
                }
                return ((AssemblyProductAttribute)customAttributes[0]).Product;
            }
        }

        public static string AssemblyTitle
        {
            get
            {
                object[] customAttributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
                if (customAttributes.Length != 0)
                {
                    AssemblyTitleAttribute assemblyTitleAttribute = (AssemblyTitleAttribute)customAttributes[0];
                    if (assemblyTitleAttribute.Title != "")
                    {
                        return assemblyTitleAttribute.Title;
                    }
                }
                return Path.GetFileNameWithoutExtension(Assembly.GetExecutingAssembly().CodeBase);
            }
        }

        public static AssemblyVersion AssemblyVersion
        {
            get
            {
                if (AssemblyAttributes.assemblyVersion == null)
                {
                    AssemblyAttributes.assemblyVersion = new AssemblyVersion(Assembly.GetExecutingAssembly().GetName().Version.ToString());
                }
                return AssemblyAttributes.assemblyVersion;
            }
        }

        public static string AssemblyWebSite
        {
            get
            {
                string[] assemblyProduct = new string[] { "http", null, null, null, null };
                assemblyProduct[1] = (AssemblyAttributes.https ? "s" : "");
                assemblyProduct[2] = "://www.";
                assemblyProduct[3] = AssemblyAttributes.AssemblyProduct;
                assemblyProduct[4] = ".com/";
                return string.Concat(assemblyProduct);
            }
        }

        public static string PurchaseUrl
        {
            get
            {
                return string.Concat(AssemblyAttributes.AssemblyWebSite, "Home/Purchase/");
            }
        }

        public static string VersionUrl
        {
            get
            {
                return string.Concat(AssemblyAttributes.AssemblyWebSite, "Version");
            }
        }

        static AssemblyAttributes()
        {
            AssemblyAttributes.https = true;
            AssemblyAttributes.ProductName = "NimbleText";
            AssemblyAttributes.ProductID = 1;
        }

        public static string MachineName()
        {
            return Environment.MachineName;
        }
    }
}
